package object05;

public class Demo05 {
    public static void main(String[] args) {
        Person p = new Person("三丰", 28);
        Animal a = new Animal();
        System.out.println(p.equals(a));

        Person p2 = new Person("四丰", 30);
        System.out.println(p.equals(p2));

        System.out.println(p2.equals(p2));//true 自己和自己比
                                          //同一个人属性肯定都相同

    }
}
/*
java.lang.ClassCastException: class object05.Animal cannot be cast to class object05.Person
强制转换异常
 Object obj=a=new Animal();
 Person p=(Person)obj;//相当于Person p= (Person)new Animal();
                      //由于Animal和Person是平级关系，所以不能强转
 */